<?php
session_start ();
ob_start ();
include_once ('include/conn.php');
$smarty->assign ( "Title", "用户订单" );
?>

<?php
$query = "SELECT * FROM sheet WHERE username = 'ReN'";
$result = mysql_query ( $query );
ob_start (); //参看手册
while ( $line = mysql_fetch_array ( $result ) ) { //这里使用了while循环
	echo "用户名:" . $line ['username'] . "<BR>";
	echo "菜式：" . $line ['dish'] . "<BR>";
	$list = explode ( ';', $line ['dish'] );
	echo "详细菜式：第一个-" . $list [0] . "第二个-" . $list [1] . "<BR>"; //这里是直接调用数组元素，当然，实际使用的时候要使用foreach ()或者其他方法来遍历数组
}
;
$caidan = ob_get_contents (); //参看手册
ob_end_clean (); //参看手册
$smarty->assign ( "Caidan", $caidan ); //把Caidan这个变量传递到tpl模板
?>
<?php

$smarty->display ( 'list.tpl' );
?>